<template>
	<view v-if="show">
		<view class="demos-header">
			<span class="header-title">户表缴费</span>
		</view>
		<div class="weui-panel weui-panel_access" v-if="showModal==1">
			<div class="weui-panel__hd">请选择要缴费的户表</div>
			<div style="width:100%;height: 55vh;overflow-y: scroll;">
				<div class="weui-panel__bd" v-for="(item,index) in list" :key="index">
					<a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg" @click="viewMeter(index)">
						<div class="weui-media-box__hd"><img src="static/meter.png" alt="" class="weui-media-box__thumb">
						</div>
						<div class="weui-media-box__bd">
							<h4 class="weui-media-box__title">户名:{{item.customerName}}-表号:{{item.meterNumber}}</h4>
							<p class="weui-media-box__desc">{{item.contactAddress}}</p>
							<p class="weui-media-box__desc">产品类型:{{item.meterType}}</p>
						</div>
					</a>
				</div>
			</div>
			<div class="weui-panel__ft">
				<navigator url="/pages/index/bindUser" class="weui-cell weui-cell_access weui-cell_link">
					<div class="weui-cell__bd">绑定新户表</div><span class="weui-cell__ft"></span>
				</navigator>
			</div>
		</div>
		<!-- 绑定客户 -->
		<div class="weui-cells weui-cells_form" v-if="showModal==2">
			<!---->
			<div class="weui-cell">
				<div class="weui-cell__hd"><label class="weui-label">户名</label></div>
				<div class="weui-cell__bd"><input type="text" placeholder="请输入户名" class="weui-input"></div>
			</div>
			<div class="weui-cell">
				<div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
				<div class="weui-cell__bd"><input type="text" placeholder="请输入手机号" class="weui-input"></div>
			</div>
			<div class="weui-btn-area"><a href="javascript:" class="weui-btn weui-btn_primary" @click="submitBind">提交</a></div>
		</div>
		<div class="weui-tabbar">
			<navigator url="/pages/index/index" class="weui-tabbar__item weui-bar__item--on router-link-active">
				<div class="weui-tabbar__icon"><img src="static/home-logo.png" alt=""></div>
				<p class="weui-tabbar__label">首页</p>
			</navigator>
		</div>
	</view>
</template>


<script>
	export default {
		components: {

		},
		data() {
			return {
				show: true,
				showModal:1,
				list:[],
				code:""
			}
		},
		onLoad() {
			var _this=this
			this.$util.checkLogin(function(token){
				_this.$request.getUserList(token,function(list){
					_this.list=list;
					uni.showToast({
						title:"加载完成",
						icon:"success"
					})
				})
			})
		},
		methods: {
			bindMeter(){
				this.showModal=2;
			},
			viewMererToNumber(meterNumber){
				uni.navigateTo({
					url:"detail?meterNumber="+meterNumber
				})
			},
			viewMeter(index){
				this.$request.params=this.list[index];
				uni.navigateTo({
					url:"detail?index="+index
				})
			}
			
		}
	}
</script>


<style lang="scss" scoped>
	
</style>
